package ssm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import ssm.entity.Stu;
import ssm.service.BaseService;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author LING
 * 控制器
 */
@Controller
@RequestMapping(value = "/stu")
public class MyController {
    @Autowired
    private BaseService baseService;

    @RequestMapping(value = "/findAll.do")
    public ModelAndView findAll(HttpServletResponse resp){
        List<Stu> all = baseService.findAll();
        ModelAndView view = new ModelAndView();
        view.addObject("stuList",all);
        view.setViewName("findAll");
        return view;
    }
}
